#!/usr/bin/env python
#
#   Copyright (C) 2006 by Patrick Stinson and Jonathan Saggau             
#   patrickkidd@gmail.com   saggau@gmail.com                              
#                                                                         
#   This program is free software; you can redistribute it and/or modify  
#   it under the terms of the GNU General Public License as published by  
#   the Free Software Foundation; either version 2 of the License, or     
#   (at your option) any later version.                                   
#                                                                         
#   This program is distributed in the hope that it will be useful,       
#   but WITHOUT ANY WARRANTY; without even the implied warranty of        
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         
#   GNU General Public License for more details.                          
#                                                                         
#   You should have received a copy of the GNU General Public License     
#   along with this program; if not, write to the                         
#   Free Software Foundation, Inc.,                                       
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
#
import unittest
from supyrconductor import node

class NodeTest(unittest.TestCase):

    def setUp(self):
        pass
        
    def test_commands(self):
        self.assertEqual(node.free(1000,1100), 
                         ['/n_free', 1000, 1100])
        self.assertEqual(node.run({1000:1, 1100:0}), 
                         ['/n_run', 1000, 1, 1100, 0])
        self.assertEqual(node.set(1100, {'vol':1,'pan':0}),
                         ['/n_set', 1100, 'vol', 1, 'pan', 0])
        self.assertEqual(node.setn(1100, {'vol':[1, 2, 3], 'test':[1, 2, 3, 4]}), 
                         ['/n_setn', 1100, 'vol', 3, 1, 2, 3, 'test', 4, 1, 2, 3, 4])
        self.assertEqual(node.fill(1100, {'vol':[8,1], 'pan':[4,2]}),
                         ['/n_fill', 1100, 'vol', 8, 1, 'pan', 4, 2])
        self.assertEqual(node.map(1100, {'vol':1500,'pan':1600}),
                         ['/n_map', 1100, 'vol', 1500, 'pan', 1600])
        self.assertEqual(node.mapn(1100, {'vol':[8,1], 'pan':[4,2]}),
                         ['/n_mapn', 1100, 'vol', 8, 1, 'pan', 4, 2])
        self.assertEqual(node.before({1:2, 3:1}),
                         ['/n_before', 1, 2, 3, 1])
        self.assertEqual(node.after({1:2, 3:1}),
                         ['/n_after', 1, 2, 3, 1])
                     
    if __name__ == '__main__':
        unittest.main()